package code.part06_Thread;

/**
 * @author: ZJT
 * @Time: 2021/7/21
 * @Description: 第二种实现方式
 */
public class P02_Runnable implements Runnable {

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName() + "--------------" + i);
        }
    }

    public static void main(String[] args) {
        P02_Runnable runnableDemo = new P02_Runnable();
        Thread thread = new Thread(runnableDemo);
        thread.start();
        for (int i = 0; i < 5; i++) {
            System.out.println(Thread.currentThread().getName() + "===========" + i);
        }
    }
}
